﻿using System;
using System.Collections.Generic;
using System.Linq;
using Infrastucture;
using TimeSplicerModule.DomainModels;

namespace DeveloperModule.ViewModels
{
    public class UserSelectionViewModel : ViewModel
    {
        private Guid _selectedUserGuid;
        private UserModel _selectedUser;
        private List<UserModel> _users;

        public Guid SelectedUserGuid
        {
            get { return _selectedUserGuid; }
            set
            {
                SetProperty(ref _selectedUserGuid, value);

                if (this.Users != null)
                    this.SelectedUser = this.Users.FirstOrDefault(x => x.UserGuid == this.SelectedUserGuid);
            }
        }
        public UserModel SelectedUser
        {
            get { return _selectedUser; }
            set { SetProperty(ref _selectedUser, value); }
        }
        public List<UserModel> Users
        {
            get { return _users; }
            set { SetProperty(ref _users, value); }
        }
    }
}
